package com.jwthhealth_pub.community.view;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.jwthhealth_pub.R;
import com.jwthhealth_pub.common.base.BaseActivity;
import com.jwthhealth_pub.common.view.TitleLayout;
import com.jwthhealth_pub.community.view.adapter.CommunityDocApplyTagAdapter;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * 医师申请
 * Created by liuzhen on 2017/12/18.
 */

public class CommunityDocApplyActivity extends BaseActivity {
    @BindView(R.id.title_layout)
    TitleLayout titleLayout;
    @BindView(R.id.rv_community_docapply_type)
    RecyclerView rvCommunityDocapplyTags;
    private CommunityDocApplyTagAdapter mDocTagAdapter;

    @Override
    protected void title() {
        titleLayout.setOnTitleLayoutListener(new TitleLayout.TitleLayoutListener() {
            @Override
            public void leftclick() {
                finish();
            }

            @Override
            public void leftTextClick() {

            }

            @Override
            public void rightclick() {

            }

            @Override
            public void rightTextClick() {

            }
        });
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_community_doc_apply);
        ButterKnife.bind(this);

        initDocClass();
    }

    private void initDocClass() {
        rvCommunityDocapplyTags.setLayoutManager(new GridLayoutManager(this, 2));

        String[] docTags = new String[]{"主任医师", "健康管理师（初级）", "副主任医师", "健康管理师（高级）",
                "主治医师", "健康管理师（初级）", "助理医师"};

        mDocTagAdapter = new CommunityDocApplyTagAdapter(this, docTags);
        rvCommunityDocapplyTags.setAdapter(mDocTagAdapter);
    }

    public void refreshDecTags() {
        rvCommunityDocapplyTags.post(new Runnable() {
            @Override
            public void run() {
                mDocTagAdapter.notifyDataSetChanged();
            }
        });
    }

    @OnClick({R.id.layout_click_id_card, R.id.layout_click_id_certification, R.id.layout_click_id_other})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.layout_click_id_card:
                //身份证
                startActivity(new Intent(this, CommunityDocApplyIdCardActivity.class));
                break;
            case R.id.layout_click_id_certification:
                startActivity(new Intent(this, CommunityDocApplyCertificationActivity.class));
                break;
            case R.id.layout_click_id_other:
                break;
        }
    }
}
